// app.js
var util = require('./utils/request');
// import Toast from './miniprogram_npm/@vant/weapp/toast/toast';
App({
  onLaunch() {
  },
  watch: function (ctx, obj) {
    Object.keys(obj).forEach(key => {
      this.observer(ctx.data, key, ctx.data[key], function (value) {
        obj[key].call(ctx, value)
      })
    })
  },
  // 监听属性，并执行监听函数
  observer: function (data, key, val, fn) {
    Object.defineProperty(data, key, {
      configurable: true,
      enumerable: true,
      get: function () {
        return val
      },
      set: function (newVal) {
        if (newVal === val) return
        fn && fn(newVal)
        val = newVal
      },
    })
  },
  globalData: {
    userInfo: null,
    request: util.request,
    cityName:"", // 定位地点
    banklist:[], // 选择的意向银行
    // 选择的企业信息
    seleproinfo:{}
  },
  onShow: function () {

  }
})